lightning web components | 您所在的位置:网站首页 › Static JavaScript resource with LWC › lightning web components |
There are a few different options: Share CSS styles among LWC components (Summer 20' update):Create a component that contains a CSS file and configuration file. >custom.css >custom.js-meta.xmlThen import it in the component you want to use the CSS file in. /** myComponent.css **/ @import 'c/custom'; /* Define other style rules for myComponent here */https://releasenotes.docs.salesforce.com/en-us/summer20/release-notes/rn_lwc_css_share.htm LWC - You can do it like above with loadStyle: import { loadStyle } from 'lightning/platformResourceLoader'; renderedCallback() { Promise.all([ loadStyle(this, resourcePath + '/custom.css'); ]) } Loading static CSS resource into a custom theme - works for both LWC and Aura. This is a nice solution if you are still using both types of Web Components.For aura: |
CopyRight 2018-2019 实验室设备网 版权所有 |